package com.IO.Stream;

import java.io.FileInputStream;
import java.io.InputStreamReader;

/**
 * name：zhangwang
 * time：2025/3/12 11:14
 */

//字符转换流
public class Reader {
    public static void main(String[] args) throws Exception {
        //创建字符输入转换流对象
        InputStreamReader inputStreamReader =
                new InputStreamReader(new FileInputStream("1_张旺-Java基础.txt"), "gbk");
        //读数据
        char[] chars = new char[1024];
        int l;
        while ((l = inputStreamReader.read(chars)) != -1) {
            System.out.println(new String(chars,0,l));
        }
        //释放资源
        inputStreamReader.close();
    }
}
